﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SES.CMS.BL;

namespace SES.CMS.Module
{
    public partial class ucRightSlide : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = Request.Url.AbsolutePath;
            url = url.Substring(1, url.Length - 1);
            string url1 = url.Replace(".", "/");
            string Module = url1.Substring(0, url1.IndexOf("/"));
            if (Module == "SanPham")
            {
                if (Request.QueryString["ID"]!= null)
                {
                    int id = int.Parse(Request.QueryString["ID"].ToString());
                    DataTable dt = new SlideBL().SelectByCate(id);
                    if (dt.Rows.Count > 0)
                    {
                        rptSlide.DataSource = dt;
                        rptSlide.DataBind();
                    }
                    else
                        rptSlide.Visible = false;
                }

            }
            else
            {
                DataTable dt = new SlideBL().SelectByCate(-1);
                DataView dtService = new DataView(dt, "", "OrderID ASC", DataViewRowState.CurrentRows);
                rptSlide.DataSource = dtService;
                rptSlide.DataBind();
            }
        }
        protected bool IsDataEmpty
        {

            get
            {

                DataTable dt = rptSlide.DataSource as DataTable;

                return dt.Rows.Count == 0 ? true : false;

            }

        }
    }
}